Terminating the Print Job
At the end of printing, your printer driver needs to clean up any storage that it has allocated. You can override theGXShutDown
message to handle this task. The ImageWriter II printer driver overrides theGXShutDown
message with theSD_Shutdown
function, which is shown in Listing 3-18. TheGXShutDown
message
is described on page 4-44 in the chapter "Printing Messages."Listing 3-18 Terminating the print job
OSErr SD_ShutDown(void) /* GXShutDown is called when the printing job is done. A good thing to do is to get rid of any additional storage. */ { /* clean up the globals */ SpecGlobalsHdl hGlobals = GetMessageHandlerInstanceContext(); /* get rid of the draft table if you allocated it */ DisposHandle((**hGlobals).draftTable); /* get get rid of allocated storage */ DisposHandle((Handle) hGlobals); /* clear out the globals - to avoid double disposes */ SetMessageHandlerInstanceContext(nil); return(noErr); }TheSD_ShutDown
function essentially reverses what theSD_Initialize
function
did at the start of printing, as shown in the section "Initializing the ImageWriter II Environment" beginning on page 3-24.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help